﻿using Archives.DbContexts;
using Archives.IService;
using Archives.Repositories;
using Archives.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Unity;
using Unity.Mvc5;

namespace Archives
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new UnityContainer();
            container.RegisterType<IDbContext, MyDbContext>();
            container.RegisterType<IRepository, Repository>();
            container.RegisterType<IWorkflowQueryService, WorkflowQueryService>();
            DependencyResolver.SetResolver(new UnityDependencyResolver(container));//MVC注入
        }
    }
}
